<%@ page language="java" import="java.util.*,com.xiaobin.system.util.*"
	pageEncoding="UTF-8"%>
<%@ include file="/base/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>${systemOption.systemTitle}</title>
<%@ include file="/base/head.jsp"%>	
<script language="javascript">
var dataUser;
var resciveId='';
var rescive='';
var dataUserBB;
var dataUserCC;

 function checksjrmc(){
 	            //检查收件人信息
            $.post("${ctx}/json/checksjrmc.action", {"sjrmc": $('#i_rescive').val() },
			   function(data){
			    if(data){
					$('#i_rescive').val(data.re);
					$('#resciveId').val(data.username);
				}else{
					$.messager.alert('友情提示','加载失败','error');
				}
			   }, "json");
 
 }



$(function(){
		$('#aa').tree ({
			animate:true,
			checkbox:'true'
			/*,
			onCheck:function(node,checked){
			if(checked==true){
				if(rescive !=''){
			 		rescive+=",";
			 	}
			 	rescive += node.text;
			}else{
				var removeStr = rescive.split(',');
				rescive="";
				for(var i = 0;i<removeStr.length;i++){
					if(removeStr[i]!= node.text){
						if(rescive !=''){
							rescive+=",";
						}
						rescive += removeStr[i];
					}
				}
			}
		}*/
	});
	
	$('#bb').tree ({
			animate:true,
			checkbox:'true'
			/*,
			onCheck:function(node,checked){
			   if(checked==true){
					if(rescive !=''){
			 		rescive+=",";
				 	}
				 	rescive+= node.text;
				}else{
					var removeStr = rescive.split(',');
					rescive = "";
					for(var i = 0;i<removeStr.length;i++){
						if(removeStr[i]!= node.text){
							if(rescive !=''){
								rescive+=",";
							}
							rescive += removeStr[i]
						}
					}
				}
		}*/
	});
	$('#zdyyh').tree ({
			animate:true,
			checkbox:'true'
	});
 });
 
 function loadUser(){
 	if(dataUser == null ) {
		    $.ajax({
		        async: false,
		        type : "post",
		        url : '${ctx}/jsonCustomer/customerCommonAction!listUserByDS.action',
		        success : function(data) {
		        	 $('#aa').tree('loadData',data);	
		        	 dataUser = data;  	 
		        }
		    });
		}
 }
 /***
 	初始化数，如果上次树被打开并且选择值则重新赋值
 
 var treeChildIds = '';
 function reloadTree(tree,childIds){
 	if(childIds.indexOf(',')){
 		var childIdStrs = childIds.split(',');
 		for(var i = 0;i<childIdStrs.length;i++){
 			var node = $(tree).tree('find',childIdStrs[i]);
 			if(null != node && node !=''){//如果名称在树上，则选中
 				$(tree).tree('check',node.target);
 			}else{//名称不在树上，则返回
 				if(treeChildIds != ''){
 					treeChildIds +=",";
 				}
 				treeChildIds += childIdStrs[i];
 			}
 		}
 	}else{
 		var node = $(tree).tree('find',childIds);
 		if(null != node && node !=''){//如果名称在树上，则选中
 				$(tree).tree('check',node.target);
 		}else{//名称不在树上，则返回
 			if(childIds != ''){
 				childIds +=",";
 			}
 			treeChildIds += childIds[i];
 		}
 	}
 }*/
 
 /**
 	制空被选中树的节点
 */
 function clearSelectedTree(tree){
 	var  pa = $(tree).tree('getChecked');//获取所有选中公司用户
	if (pa) {
		for(var i = 0;i<pa.length;i++){
			$(tree).tree('uncheck', pa[i].target);
	  }
    }
 }
 
 function loadUserBB(){
 	if(dataUserBB == null ) {
		    $.ajax({
		        async: false,
		        type : "post",
		        url : '${ctx}/json/listLinkManByDS.action',
		        success : function(data) {
		        	 $('#bb').tree('loadData',data);	
		        	 dataUserBB = data;  	 
		        }
		    });
		}
 }
 
  function loadUserCC(){
 	if(dataUserCC == null ) {
		    $.ajax({
		        async: false,
		        type : "post",
		        url : '${ctx}/json/listGsLinkManByDS.action',
		        success : function(data) {
		        	 $('#zdyyh').tree('loadData',data);	
		        	 dataUserCC = data;  	 
		        }
		    });
		}
 }
function bb(){
	var show = $("#cc").css("display");
	if(show =='table-row'){
		if($("#i_cc").val() != ""){
			var del = window.confirm("你确定要删除 \"抄送人\" 吗？ ");
			if (del) {$("#i_cc").val("");focus="";}
			else return ;
		}
		$("#acc").text("添加抄送");
	}else{	
		$("#acc").text("删除抄送");
		focus = "i_cc";
	}
	$("#cc").toggle('normal');
}
function cbb(){
	var show = $("#bcc").css("display");
	if(show =='table-row'){
		if($("#i_bcc").val() != ""){
			var del = window.confirm("你确定要删除 \"密送人\" 吗？ ");
			if (del) {$("#i_bcc").val("");focus="";}
			else return ;
		}
		$("#abcc").text("添加密送");
	}else{
		$("#abcc").text("删除密送");
		focus = "i_bcc";	
	}
	$("#bcc").toggle('normal');
};
//自动添加收件人
var focus = "";//获取焦点的id
function inputfocus(){
	focus= document.activeElement.id;
	$('#i_rescive').attr('title','多个收件人请以逗号(,)分隔');
}
//点击联系人添加到列表中
function add(value) {
	var obj = $(value).attr("title") + ";";
	if (focus == "i_cc") {//抄送
		var val = $("#i_cc").val();
		var is = val.match(obj);
		if (is == null) {
			$("#i_cc").val($("#i_cc").val() + obj);
		}
		$("#i_cc").focus();
		focus = "i_cc";
	} else if (focus == "i_bcc") {//密送
		var val = $("#i_bcc").val();
		var is = val.match(obj);
		if (is == null) {
			$("#i_bcc").val($("#i_bcc").val() + obj);
		}
		$("#i_bcc").focus();
		focus = "i_bcc";
	} else {//收件人
		var val = $("#i_rescive").val();
		var is = val.match(obj);
		if (is == null) {
			$("#i_rescive").val($("#i_rescive").val() + obj);
		}
		$("#i_rescive").focus();
	}
}
//上传附件
$(document).ready(function() {
	$("#uploadify").uploadify({
	    'uploader'       : '${ctx }/js/jquery.uploadify-v2.1.0/images/uploadify.swf',
	    'script'         : '${ctx }/json/doUpload.action',
	    'fileDataName'   : 'fileDate',
	    'folder'         : '/',
	    'queueID'        : 'fileQueue',
	    'queueSizeLimit' : 6,
	    'multi'          : true,
	    'auto'           : true,
	    'sizeLimit'      : 1024*1024*50, 
	    'simUploadLimit' : 2,
	    'buttonImg'      : '${ctx }/js/jquery.uploadify-v2.1.0/images/attach.png', 
	    'height'         : 20,
	    'width'          : 50,
	    'cancelImg'      : '${ctx }/js/jquery.uploadify-v2.1.0/images/cancel.png',
	    'wmode'          : 'transparent' ,
	    'uploadLimit'    : 6,
	    //事件
	    onSelect :function(event,queueId,fileObj){
	    	$("#fujian").css("display","table-row"); 
	    	var bytes = Math.round(fileObj.size / 1024);
	    	$("#divComposeAttachContent ul").append(
	    	"<li id='"+queueId +"'>"+
			"<span class=\"ico_attState\"></span>"+
			"<span class=\"person\">"+fileObj.name+"</span><div class='progress' id='progress'>"+
			"<span class=\"g-pro\"><span class=\"g-pro-inner p_bar\" style=\"width:0%\"></span></span>"+
			"<span class=\"bc p_pa\">0%</span>"+
			"<span class=\"bc\">已上传<em class='p_c'>0K</em>，文件大小<em>"+bytes+"K</em></span></div>"+
			"<span class=\"bW\"><a href=\"javascript:$('#uploadify').uploadifyCancel('"+queueId+"')\">删除</a></span>"+
			"</li>"
	    	);
	    },
	    onClearQueue : function(event){
	    	$("#divComposeAttachContent ul").empty();
	    	$("#fujian").css("display","none");
	    },
	    onCancel :function(event,queueId,fileObj,data){
	    	$("#"+queueId).remove();
	    	if($("#fujian").find("li").size() == 0)
	    		$("#fujian").css("display","none");
	    },
	    onProgress : function(event,queueId,fileObj,data){
	    	var bytes = Math.round(data.bytesLoaded / 1024);
	    	$("#"+queueId).find(".p_bar").css("width",data.percentage+"%");
	    	$("#"+queueId).find(".p_pa").text(data.percentage+"%");
	    	$("#"+queueId).find(".p_c").text(bytes+"K");
	    	$("#"+queueId).find("a").attr("href","javascript:deleteAttach('"+queueId+"','"+fileObj.name+"')");//删除以上传的附件
	    	return false;
	    },
	    onComplete : function (event, queueId, fileObj, response, data){ 
	    	if(response!='0'){
	    		var fileName = $('#fileNameId').val();
	    		if(fileName !=""){
	    			fileName+=","
	    		}
	    		fileName += queueId+"@_@"+response;
	    		$('#fileNameId').val(fileName);

	    		var fujianName = $('#fujianNameId').val();
		    	if(fujianName !=''){
		    		fujianName +=",";
		    	}
		    	fujianName +=queueId+"@_@"+fileObj.name;
		    	$('#fujianNameId').val(fujianName);
	    		
	    		$("#"+queueId).addClass("success");
	    	}
	    	else {
	    		$("#"+queueId).addClass("error");
	    	}
	    },
	    onError : function(event,queueId,fileObj,errorObj){
	    	$("#"+queueId).addClass("error");
	    	if(fileObj.size>1024*1024*50){
	    		$.messager.alert('友情提示','你上传的 \“'+fileObj.name+'\” 文件过大，请上传小于50M的附件。','info');
	    		return;
	    	}
	    }
	   });
	});
	//删除附件
	function deleteAttach(queueId,name){
		$("#"+queueId).remove();
		var fileName = $('#fileNameId').val();
		var fujianName = $('#fujianNameId').val();
		var strs = fileName.split(',');
		var names = fujianName.split(',');
		var newFile = [];
		var newName = [];
		//删除自动生成的名称
		
		
		if(strs.length>0){
			for(var i = 0;i<strs.length;i++){
				var ids = strs[i].split('@_@');
				if(ids[0]==queueId){
			    	fileName = ids[1];
				}else{
					newFile.push(strs[i]);
					newName.push(names[i]);
				}
			}
		}
		
		newFile.join(',');
		newName.join(',');
		
		//删除文件名称
		if($("#fujian").find("li").size() == 0){
			$("#fujian").css("display","none");
		}
		$.ajax({
			   type: "POST",
			   url: "${ctx }/json/deleteAtt.action",
			   data: "fileName="+fileName
		});
		$('#fileNameId').val(newFile);
		$('#fujianNameId').val(newName);
	}
	//保存到草稿箱
	function saveDraft(){
		var to =$.trim($("#i_rescive").val());
		var sub = $("#i_subject").val();
		var con = $("#i_content").val();
		var cc =$.trim($("#i_cc").val());
		var bcc =$.trim($("#i_bcc").val());
		if(to == "" || to.length==0){
			$.messager.alert('友情提示','请填写收信人！','info');
			return ;
		} 
		if(sub == "" || sub.length==0){
			$.messager.alert('友情提示','请填写邮件主题！','info');
			return ;
		} 
		/*
		
		if(to != "" && to.length>0){
			if(!reg.test(to)){
					alert("你输入的收件人地址不正确!");return ;
			}
		} 
		if(cc != "" && cc.length>0){
			if(!reg.test(cc)){
				alert("你输入的抄送人地址不正确!");return ;
			}
		} 
		if(bcc != "" && bcc.length>0){
			if(!reg.test(bcc)){
				alert("你输入的密送人地址不正确!");return ;
			}
		} */
		var checked = $("#isHuiZhi").attr("checked");
		if(checked =='checked'){
			$("#isHuiZhi").val('2');
		}else if(checked !='checked'){
			$("#isHuiZhi").val('1');
		}
		showProcess(true, '温馨提示', '正在保存到草稿箱...'); 
		$('#send').val(1);
		$('#sendmail').form('submit',{
			success: function(data){
			    if(!!data==true){
					window.location = "${ctx}/zhgl/writeAgain.action?returnType=3";
				}else{
					window.location = "${ctx}/zhgl/writeAgain.action?returnType=4";
				}
				showProcess(false);
				$('#sendmail').form('reset');
				editor_a.setContent('');
				$("#fujian").css("display","none");
			}  
		});
	}
	//发送邮件(检测收件人)
	var reg = /^((\w+([-_.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*;)|(".*"<\w+([-_.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*>;))*((\w+([-_.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*(;?))|(".*"<\w+([-_.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*>(;?)))$/;
	function checkTo(){
		var to =$.trim($("#i_rescive").val());
		var sub = $("#i_subject").val();
		var con = $("#i_content").val();
		var cc =$.trim($("#i_cc").val());
		var bcc =$.trim($("#i_bcc").val());
		if(to == "" || to.length==0){
			$.messager.alert('友情提示','请填写收信人！','info');
			return ;
		} 
		if(sub == "" || sub.length==0){
			$.messager.alert('友情提示','请填写邮件主题！','info');
			return ;
		} 
		/*
		
		
		if(to != "" && to.length>0){
			if(!reg.test(to)){
				$.messager.alert('友情提示','你输入的收件人地址不正确!','error');	
				return ;
			}
		} 
		if(cc != "" && cc.length>0){
			if(!reg.test(cc)){
			   $.messager.alert('友情提示','你输入的抄送人地址不正确!','error');	
			   return;
			}
		} 
		if(bcc != "" && bcc.length>0){
			if(!reg.test(bcc)){
				$.messager.alert('友情提示','你输入的密送人地址不正确!','error');	
				return ;
			}
		}
		*/
		$('#send').val(2);
		var checked = $("#isHuiZhi").attr("checked");
		if(checked =='checked'){
			$("#isHuiZhi").val('2');
		}else if(checked !='checked'){
			$("#isHuiZhi").val('1');
		}
		showProcess(true, '温馨提示', '正在发送邮件..');
		$('#sendmail').form('submit',{
			success: function(data){
			   //if(data=='true'){
			   if(!!data==true){
					window.location = "${ctx}/zhgl/writeAgain.action?returnType=1";
				}else{
					window.location = "${ctx}/zhgl/writeAgain.action?returnType=2";
				}
				showProcess(false);
				$('#sendmail').form('reset');
				 editor_a.setContent('');
				$("#fujian").css("display","none");
			}
		});
	}
	
	//清除div信息
	function resetMessage(){
		$("#messageDiv").removeClass();
		$("#message").empty().append("");
	}
	function showProcess(isShow, title, msg) {
       if (!isShow) {
            $.messager.progress('close');
            return;
       }
        var win = $.messager.progress({
            title: title,
            msg: msg,
            text:''
        });
   }
   function showTxl(){
   		resciveId='';
   		rescive='';
   		loadUser();
   		loadUserBB();
   		loadUserCC();
   		$('#txlId').show();
   		$('#txlId').dialog({
   			title:'通讯录',
        	modal:true,
        	closable:false,
        	buttons: [{
			text:'确定',
			iconCls:'icon-ok',
			handler:function(){
				$('#i_rescive').val('');
	        	var  pa = $('#aa').tree('getChecked');//获取所有选中公司用户
	        	var  paBB = $('#bb').tree('getChecked');//获取所有选中邮箱用户
	        	var  paCC = $('#zdyyh').tree('getChecked');//获取所有选中邮箱用户
	        	if(pa == '' && paBB =='' && paCC==''){
	        		$.messager.alert('友情提示','请选择收件人!','error');	
	        		return;
	        	}
				for(var i = 0;i<pa.length;i++){
			 		if(isNaN(pa[i].id)){
				 		if(resciveId !=''){
				 			resciveId +=",";
				 			rescive +=",";
				 		}
			 			resciveId += pa[i].id;
			 			rescive += pa[i].text;
			 		}
			 	}
			 	for(var i = 0;i<paCC.length;i++){
			 		if(isNaN(paCC[i].id)){
				 		if(resciveId !=''){
				 			resciveId +=",";
				 			rescive +=",";
				 		}
			 			resciveId += paCC[i].id;
			 			rescive += paCC[i].text;
			 		}
			 	}
				for(var i = 0;i<paBB.length;i++){
			 		if(paBB[i].text.indexOf('[')!=-1){//获取选中的叶子节点
			 		 var strs = paBB[i].text.split('[');
			 		 var str = strs[1].split(']');
				 		if(resciveId !=''){
				 			resciveId +=",";
				 			rescive +=",";
				 		}
			 			resciveId += str[0]+"@_@"+paBB[i].id;
			 			rescive += paBB[i].text;
			 		}
			 	}
			 	var subStr = '';
			 	if(rescive.length>3000000){
			 		subStr = rescive.substring(0,296)+"..";
			 	}else{
			 		subStr = rescive;
			 	}
			 	$('#i_rescive').val(subStr);
			 	$('#resciveId').val(resciveId);
			 	$('#txlId').dialog('close');
			}
			
		},{
			text:'关闭',
			iconCls:'icon-cancel',
			handler:function(){
			 	$('#txlId').dialog('close');
			 	
			 	clearSelectedTree('#aa');
			 	clearSelectedTree('#bb');
			 	clearSelectedTree('#zdyyh');
			 	//选中所选节点
			 	var resId = $('#resciveId').val();
			 	var allCheck = resId.split(',');
			 	for(var i = 0;i<allCheck.length;i++){
			 		if(allCheck[i].indexOf('@_@')==-1){
			 			var node = $('#aa').tree('find',allCheck[i]);
			 			if(null != node && node !=''){//如果名称在树上，则选中
			 				$('#aa').tree('check',node.target);
			 			}
			 			var node = $('#zdyyh').tree('find',allCheck[i]);
			 			if(null != node && node !=''){//如果名称在树上，则选中
			 				$('#zdyyh').tree('check',node.target);
			 			}
			 		}else{
			 			var node = $('#bb').tree('find',allCheck[i].split('@_@')[1]);
			 			if(null != node && node !=''){//如果名称在树上，则选中
			 				$('#bb').tree('check',node.target);
			 			}
			 		}
	  			}
			}
		}]
   	 });
   }
   function writeAgain(){
   	 $('#writeMail').dialog('close');
   }
   function changeTextTitle(){
   		$("#i_rescive").attr('title',rescive);
   }
   /**
   	清空接收人，并且把接收人的隐藏域清空掉
   */
   function clearSjrName(){
   	$("#i_rescive").val('');
   	$('#resciveId').val('');
   	//清空树
   	clearSelectedTree('#aa');
	clearSelectedTree('#bb');
	clearSelectedTree('#zdyyh');
   }
   
   function test(){
  		 $.post("${ctx}/json/sendMails.action", 
			   function(data){
			    if(data){
					$.messager.alert('友情提示','发送成功','error');
				}else{
					$.messager.alert('友情提示','发送失败','error');
				}
			   }, "json");
   }
</script>
<style type="text/css">
.sendMail{width:auto;overflow:hidden; border:2px solid  #A5E6E9;}
.send tr td{padding-bottom:5px; padding-top:5px; height:auto;}
.table{margin-top:10px;}
.label{ text-align:right;padding-right:5px; padding-left:15px; width:55px}
.s_input{width:99%;height:26px;font-size: 12px;font-family: Verdana,Geneva,sans-serif;overflow:auto;word-break:break-all;}
.s_subject{width:99%;height:20px;font-size: 12px;font-family: Verdana,Geneva,sans-serif;overflow:auto;word-break:break-all;}
.person{font-family: Verdana, Geneva, sans-serif;}
.send tr td a:link,a:visited{text-decoration:underline;color:#005590;}
.send tr td  a:hover {text-decoration:none; }
 input:focus ,textarea:focus{ background-color: #FFFFE1}
.content{width:auto; overflow:hidden; }
.ico_attState{background-image: url("${ctx }/js/jquery.uploadify-v2.1.0/images/ico.gif");  background-position: -135px -8px; width:16px;height: 14px; display:inline-block;}
.bc{margin-right: 5px;vertical-align: middle;}
.br{color:#565656;}
.g-pro{width: 100px; display:inline-block;height:7px;border:1px solid #ccc;background:#fff;padding:1px;overflow:hidden;vertical-align: middle;}
.g-pro-inner{vertical-align: top;display:inline-block;height:7px;display:inline-block;background-color:#00CC33}
.addAttachment,.progress{display:inline-block;}
#uploadifyUploader{vertical-align: middle;}
#divComposeAttachContent ul li {display:block;padding: 0px;margin: 0px;list-style: none;}
#divComposeAttachContent span{margin-right: 5px;}
.error{ background-color: #FDE5DD ;border: 1px solid #FBCBBC ;}
.success{ background-color: #D6FADD ;border: 1px solid #DDF2E0;}
.divProgress{height: 18px; width: auto; position: absolute;margin: 0 auto; padding: 5px 10px;left: 100px; top: 0px;background-color: #E6A800; display: none;}
.proImag{background-image: url("${ctx }/js/jquery.uploadify-v2.1.0/images/loading.gif");display: inline-block; width: 16px;height: 16px;}
#spanProgress{vertical-align: middle;padding-left: 10px; color: white;}
</style>
</head>

<body style="margin:0px;" class="easyui-layout">
<!-- 顶部 -->
<div data-options="region:'north'" style="height:30px;">
	<a href="javascript:void(0)" onclick="checkTo();" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" style="float:left;">发送</a><div class="datagrid-btn-separator"> </div>
	<a href="javascript:void(0)" onclick="saveDraft();" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true" style="float:left;">保存草稿</a><div class="datagrid-btn-separator"> </div>
	<!-- <a href="javascript:void(0)" onclick="test();" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" style="float:left;">定时发送</a><div class="datagrid-btn-separator"> </div> -->
</div>
<div data-options="region:'south'" style="height:30px;">
	<a href="javascript:void(0)" onclick="checkTo();" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" style="float:left;">发送</a><div class="datagrid-btn-separator"> </div>
	<a href="javascript:void(0)" onclick="saveDraft();" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true" style="float:left;">保存草稿</a><div class="datagrid-btn-separator"> </div>
</div>
<div data-options="region:'center'" style="padding:5px;background:#eee;">
<div class="divProgress" id="divProgress"><span class="proImag"></span><span id="spanProgress"></span></div>
<div class="sendMail" id="sendmailInfo">
<div>
<div id="messageDiv" class="message" align="center" >
		<span id="message"></span>
	</div>
<form action="${ctx }/json/sendMail.action" method="post" id="sendmail">
<table class="send"  width="100%" border="0" cellspacing="0" cellpadding="0">
<!--<tr>-->
<!--    <td align="right" colspan="3"><a href="javascript:bb()" id="acc">添加抄送</a>&nbsp;|&nbsp;<a href="javascript:cbb()" id="abcc">添加密送</a></td>-->
<!--</tr>-->
<tr>
	<td class="label"><a href="#" onclick="showTxl()" style="color:blue;text-decoration:underline;width: 30px" >收件人:</a></td>
    <td class="e_input" colspan="2">
<!--    <textarea  title="多个收件人请以分号(;)分隔"  class="s_input" id="i_rescive" onfocus="inputfocus()"  -->
<!--			  onpropertychange="this.style.height=this.scrollHeight+'px';"  oninput="this.style.height=this.scrollHeight+'px';" -->
<!--			  style="overflow:hidden;height:16px;" name="mail.to" onchange="resetMessage()">515307665@qq.com</textarea>-->
<!--	<textarea name="mail.to" cols="2" style="overflow-y:hidden;height:20px;width:90%;" onpropertychange="this.style.height=this.scrollHeight+'px';" -->
<!--			  oninput="this.style.height=24+'px';this.style.height=this.scrollHeight+'px';"  id="i_rescive" onfocus="inputfocus();" onchange="resetMessage()" onmousemove="changeTextTitle();" onblur="checksjrmc()" ></textarea>-->
	<textarea name="mail.to" cols="2" style="height:20px;width:90%;" onpropertychange="this.style.height=this.scrollHeight+'px';" 
			  oninput="this.style.height=24+'px';this.style.height=this.scrollHeight+'px';"  id="i_rescive" onfocus="inputfocus();" onchange="resetMessage()" onmousemove="changeTextTitle();" onblur="checksjrmc()" ></textarea>
   <a href="#" style="color: blue" onclick="clearSjrName()">清空</a>
    </td>
	 <input type="hidden" id="resciveId" name="mail.resciveId"/>
</tr>
<tr id="cc" style="display: none;">
	<td class="label" width="30px">抄送:</td>
    <td class="e_input" colspan="2"><textarea  title="多个抄送人请以分号(;)分隔" class="s_input" id="i_cc" onfocus="inputfocus()"  onpropertychange="this.style.height = this.scrollHeight + 'px';" oninput="this.style.height = this.scrollHeight + 'px';" name="mail.cc"></textarea></td>
</tr>
<tr id="bcc" style="display: none;">
	<td class="label" width="30px">密送:</td>
    <td class="e_input" colspan="2"><textarea   title="多个密送人请以分号(;)分隔"  class="s_input" id="i_bcc" onfocus="inputfocus()"  onpropertychange="this.style.height = this.scrollHeight + 'px';" oninput="this.style.height = this.scrollHeight + 'px';" name="mail.bcc"></textarea></td>
</tr>
<tr id="subject">
	<td class="label" width="30px">主题:</td>
    <td class="e_input" colspan="2"><input type="text" title="邮件主题"  class="s_subject" id="i_subject" name="mail.subject"/>
    <input type="hidden" id="fileNameId" name= "mail.fileName"/>
    <input type="hidden" id="fujianNameId" name= "mail.fujianName"/>
    <input type="hidden" id="send" name= "send" />
    </td>
</tr>
<tr id="addfujian">
	<td class="label"></td>
    <td class="e_input" colspan="2">
    <div class="addAttachment">
    	<input type="file" name="fileDate" id="uploadify" title="添加小于20M的文件作为附件" />
	</div>
	</td>
</tr>
<tr id="fujian" style="display: none;">
	<td class="label"></td>
    <td class="e_input" colspan="2" style="background-color: #F0F0F0;">
    <div class="attach">
    <div id="divComposeAttachContent" class="cn">
		<ul>
			<!-- 上传附件列表 -->
		</ul>
	</div>
</div>
    </td>
</tr>
<tr id="content">
	<td class="label" width="10%">内容:</td>
    <td class="e_input" colspan="2">
		<div id="editor" name="mail.content" type="text/plain" style="height:250px;width:90%;word-break:break-all;"></div>
		<script type="text/javascript" charset="UTF-8">
	   	//实例化编辑器
		var editor_a = new baidu.editor.ui.Editor({
		//这里可以选择自己需要的工具按钮名称
			toolbars:[['fullscreen',
                'bold', 'italic', 'underline', 'forecolor', 'insertorderedlist', 'insertunorderedlist', '|',
                'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                'indent', 'justifyright', 'justifyjustify', '|',
                'link', 'unlink', '|','insertimage', 'emotion', 'map', 'gmap',
                'date', 'time', 'spechars', 'snapscreen', '|',
                'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',
                'print', 'preview', 'searchreplace', 'help']],elementPathEnabled : false,lang:"zh-cn",langPath:"${ctx}/ueditor/lang/"
			});
			editor_a.render('editor'); //此处的参数值为编辑器的id值
		</script>
    </td>
</tr>
<tr>
	<td></td>
	<td><input type="checkbox" id="isHuiZhi" name="mail.replysign"/>需要回执</td>
	
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- 通讯录 -->
<div data-options="title:'通讯录'" style="width:450px;display: none" id="txlId">
<div id="rr" class="easyui-tabs" style="width: 240px; height:300px; float:left;" data-options="fit:true,border:false">
<div title="公司用户">  
	<ul id="aa" class="easyui-tree"></ul>
</div>
<div title="我的分组" style="height: 400px;">  
	<ul id="zdyyh" class="easyui-tree"></ul>
</div>
<div title="其他联系人" style="height: 400px;">
	<ul id="bb" class="easyui-tree"></ul>
</div>
</div>
</div>
</body>
</html>
